<%--
@author Sisiruwan Senadeera
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<script type="text/javascript">
    $(function() {
        $('select#district').bind('change', function(evt1) {
            var id = $("select#district").attr("value");
            $.getJSON('${pageContext.request.contextPath}/common/DivisionLookupService', {id:id,mode:4},
                     function(data) {
                         //var options1 = '<option value="0"> - Select  - </option> ';
                         var options1 = '<option value="0">' + $('#select').val() + '</option> ';
                         var ds = data.dsDivisionList;
                         for (var i = 0; i < ds.length; i++) {
                             options1 += '<option value="' + ds[i].optionValue + '">' + ds[i].optionDisplay + '</option>'

                         }
                         $("select#dsDivision").html(options1);
                     });
        });
    });

    function viewLandDetails(landId) {
       var url = '${"findClildrenByParentLand.do?landId=' + landId + '"}';
        $.get(url, $(this).serialize(), function(data) {
            $("#landDetails").html(data);
        });
    }
</script>

<div class="page-title">
    <h2><s:label value="%{getText('initial_land_application.label')}"/></h2>
</div>

<div align="left" style="color:red"> 
        <s:actionerror/>
        <s:actionmessage/>
</div>

<%--<div id="search-lands-form-outer">--%>
    <table>
        <tr>
            <s:form name="onlineApplicantDirection" id="onlineApplicantDirectionId" method="POST">

                <td class="left-align"><s:label value="%{getText('district.label')}"/></td>
                <td><s:select list="districtList" name="onlineApplicantDistrictId" headerKey="0" headerValue="%{getText('select.label')}"
                              id="district"/></td>
                <td class="left-align"><s:label value="%{getText('ds_division.label')}"/></td>
                <td><s:select name="onlineApplicantDsDivisionId" id="dsDivision" headerKey="0" headerValue="%{getText('select.label')}"
                              list="dsDivisionList" cssClass="width-180-px"/>
                </td>
                <td><s:submit id="onlineApplicationLoadId" action="onlineApplicationLoad" value="%{getText('load_application.label')}" /></td>
            </s:form>
        </tr>
    </table>
<%--</div>--%>
<div id="landDetails">
</div>
<%-- Localization text for java script generated text --%>
<s:hidden id="ref" value="%{getText('reference_no.label')}"/>
<s:hidden id="lname" value="%{getText('name_of_the_land.label')}"/>
<s:hidden id="plan" value="%{getText('plan_no.label')}"/>
<s:hidden id="lot" value="%{getText('lot_no.label')}"/>
<s:hidden id="action" value="%{getText('action.label')}"/>
<s:hidden id="viewTooltip" value="%{getText('view_tooltip.label')}"/>
<s:hidden id="undifined" value="%{getText('undefined.label')}"/>

<%-- Localization text for data tables --%>
<s:hidden id="display" value="%{getText('display.label')}"/>
<s:hidden id="records" value="%{getText('records.label')}"/>
<s:hidden id="search" value="%{getText('search.label')}"/>
<s:hidden id="no-record" value="%{getText('no_record.label')}"/>
<s:hidden id="showing" value="%{getText('showing.label')}"/>
<s:hidden id="to" value="%{getText('to.label')}"/>
<s:hidden id="of" value="%{getText('of.label')}"/>
<s:hidden id="entries" value="%{getText('entries.label')}"/>
<s:hidden id="first" value="%{getText('first.label')}"/>
<s:hidden id="last" value="%{getText('last.label')}"/>
<s:hidden id="next" value="%{getText('next.label')}"/>
<s:hidden id="previous" value="%{getText('previous.label')}"/>
<s:hidden id="select" value="%{getText('select.label')}"/>



